﻿using EP.Core;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace Api
{
    public class EPEngine : IEngine
    {
        private IServiceProvider _serviceProvider;
        public EPEngine(IServiceProvider serviceProvider)
        {
            this._serviceProvider = serviceProvider;
        }
        /// <summary>
        /// 构建服务实例
        /// </summary>
        public T Resolve<T>() where T : class
        {
            return _serviceProvider.GetRequiredService(typeof(T)) as T;
            // return _serviceProvider.GetService(typeof(T)) as T;
        }
    }
}
